import java.util.ArrayList;

class AI
{
	private ArrayList<String> coordsInMind = new ArrayList<String>();
	private boolean success = false;
	private boolean finishHim = false;
	private static AI instance;
	
	public String coordInMind()
	{
		String coord;
		
		if (coordsInMind.isEmpty())
		{
			coord = null;
		}
		else
		{
			coord = coordsInMind.get(coordsInMind.size() - 1).toString();
		}
		
		return coord;
		
	}
	
	public boolean finishHim()
	{
		return finishHim;
	}
	
	public void success(boolean status)
	{
		success = status;
		
		if (coordsInMind.size() > 1 && !success)
		{
			finishHim = true;
		}
		else
		{
			finishHim = false;
		}
	}
	
	public ArrayList<String> coordsInMind()
	{
		return coordsInMind;
	}
	
	public static AI getInstance()
	{
		if (instance == null)
		{
			instance = new AI();
		}
		
		return instance;
	}
	
	public void keepCoordInMind(String coord)
	{
		if (coord == null)
		{
			coordsInMind = new ArrayList<String>();
		}
		else
		{
			coordsInMind.add(coord);
			success = true;
		}
	}
}